<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: VGA/HardwareTest/HardwareTest.ino</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 Display Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_v_g_a_2_hardware_test_2_hardware_test_8ino-example.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">VGA/HardwareTest/HardwareTest.ino</div>  </div>
</div><!--header-->
<div class="contents">
<p>Hardware test with GUI</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - www.fabgl.com</span></div><div class="line"><span class="comment">  Copyright (c) 2019-2020 Fabrizio Di Vittorio.</span></div><div class="line"><span class="comment">  All rights reserved.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  This file is part of FabGL Library.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is free software: you can redistribute it and/or modify</span></div><div class="line"><span class="comment">  it under the terms of the GNU General Public License as published by</span></div><div class="line"><span class="comment">  the Free Software Foundation, either version 3 of the License, or</span></div><div class="line"><span class="comment">  (at your option) any later version.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is distributed in the hope that it will be useful,</span></div><div class="line"><span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div><div class="line"><span class="comment">  GNU General Public License for more details.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  You should have received a copy of the GNU General Public License</span></div><div class="line"><span class="comment">  along with FabGL.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabgl_8h.html">fabgl.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabui_8h.html">fabui.h</a>&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;WiFi.h&gt;</span></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><a name="_a0"></a><a class="code" href="classfabgl_1_1_v_g_a16_controller.html">fabgl::VGA16Controller</a> DisplayController;</div><div class="line"><a name="_a1"></a><a class="code" href="classfabgl_1_1_p_s2_controller.html">fabgl::PS2Controller</a>   PS2Controller;</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="keyword">struct </span>TestApp : <span class="keyword">public</span> uiApp {</div><div class="line"></div><div class="line">  uiFrame *        frame;</div><div class="line">  uiButton *       soundButton;</div><div class="line">  SoundGenerator * soundGenerator;</div><div class="line">  uiTimerHandle    soundTimer;</div><div class="line">  uiButton *       sdButton;</div><div class="line">  uiLabel *        sdResultLabel;</div><div class="line">  uiComboBox *     gpioInComboBox;</div><div class="line">  uiButton *       gpioInState;</div><div class="line">  uiComboBox *     gpioOutComboBox;</div><div class="line">  uiButton *       gpioOutState;</div><div class="line">  uiTimerHandle    gpioTimer;</div><div class="line">  uiButton *       wifiButton;</div><div class="line">  uiLabel *        wifiResultLabel;</div><div class="line"></div><div class="line">  <span class="keywordtype">int</span>              gpioIn, gpioOut;</div><div class="line"></div><div class="line"></div><div class="line">  ~TestApp() {</div><div class="line">    <span class="keyword">delete</span> soundGenerator;</div><div class="line">  }</div><div class="line"></div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> init() {</div><div class="line"></div><div class="line">    rootWindow()-&gt;frameStyle().backgroundColor = <a name="a2"></a><a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cac1e9bce8242f443c54c7405223d616cd">Color::Black</a>;</div><div class="line">    frame = <span class="keyword">new</span> uiFrame(rootWindow(), <span class="stringliteral">&quot;Hardware test&quot;</span>, UIWINDOW_PARENTCENTER, Size(600, 350));</div><div class="line"></div><div class="line">    <span class="keywordtype">int</span> y = 20;</div><div class="line"></div><div class="line">    <span class="comment">// colors</span></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;COLORS TEST:&quot;</span>, Point(10, y));</div><div class="line">    y += 20;</div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * COLORSL[8] = { <span class="stringliteral">&quot;Black&quot;</span>, <span class="stringliteral">&quot;Red&quot;</span>, <span class="stringliteral">&quot;Green&quot;</span>, <span class="stringliteral">&quot;Yellow&quot;</span>, <span class="stringliteral">&quot;Blue&quot;</span>, <span class="stringliteral">&quot;Magenta&quot;</span>, <span class="stringliteral">&quot;Cyan&quot;</span>, <span class="stringliteral">&quot;White&quot;</span> };</div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * COLORSH[8] = { <span class="stringliteral">&quot;B. Black&quot;</span>, <span class="stringliteral">&quot;B. Red&quot;</span>, <span class="stringliteral">&quot;B. Green&quot;</span>, <span class="stringliteral">&quot;B. Yellow&quot;</span>, <span class="stringliteral">&quot;B. Blue&quot;</span>, <span class="stringliteral">&quot;B. Magenta&quot;</span>, <span class="stringliteral">&quot;B. Cyan&quot;</span>, <span class="stringliteral">&quot;B. White&quot;</span> };</div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 8; ++i) {</div><div class="line">      <span class="keywordtype">int</span> left = 60;</div><div class="line">      <span class="keywordtype">int</span> hspc = 60;</div><div class="line">      <span class="keywordtype">int</span> vspc = 30;</div><div class="line">      <span class="keyword">new</span> uiLabel(frame, COLORSL[i], Point(left + i * hspc, y));</div><div class="line">      <span class="keyword">new</span> uiColorBox(frame, Point(left + i * hspc, y + 15), Size(50, 14), (<a name="a3"></a><a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#gab87bacfdad76e61b9412d7124be44c1c">Color</a>)i);</div><div class="line">      <span class="keyword">new</span> uiLabel(frame, COLORSH[i], Point(left + i * hspc, y + vspc));</div><div class="line">      <span class="keyword">new</span> uiColorBox(frame, Point(left + i * hspc, y + 15 + vspc), Size(50, 14), (<a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#gab87bacfdad76e61b9412d7124be44c1c">Color</a>)(i+ 8));</div><div class="line">    }</div><div class="line"></div><div class="line">    y += 80;</div><div class="line"></div><div class="line">    <span class="comment">// keyboard test</span></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;KEYBOARD TEST:&quot;</span>, Point(10, y));</div><div class="line">    <span class="keyword">new</span> uiTextEdit(frame, <span class="stringliteral">&quot;Please type something&quot;</span>, Point(120, y - 3), Size(450, 20));</div><div class="line"></div><div class="line">    y += 40;</div><div class="line"></div><div class="line">    <span class="comment">// sound test</span></div><div class="line">    soundGenerator = <span class="keyword">new</span> SoundGenerator;</div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;SOUND TEST:&quot;</span>, Point(10, y));</div><div class="line">    soundButton = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Start&quot;</span>, Point(120, y - 3), Size(80, 20), uiButtonKind::Switch);</div><div class="line">    soundButton-&gt;onChange = [&amp;]() {</div><div class="line">      <span class="keywordflow">if</span> (soundButton-&gt;down()) {</div><div class="line">        soundButton-&gt;setText(<span class="stringliteral">&quot;Stop&quot;</span>);</div><div class="line">        soundTimer = setTimer(frame, 250);</div><div class="line">      } <span class="keywordflow">else</span> {</div><div class="line">        soundButton-&gt;setText(<span class="stringliteral">&quot;Start&quot;</span>);</div><div class="line">        killTimer(soundTimer);</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    y += 40;</div><div class="line"></div><div class="line">    <span class="comment">// SD Card test</span></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;SDCARD TEST:&quot;</span>, Point(10, y));</div><div class="line">    sdButton = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Start&quot;</span>, Point(120, y - 3), Size(80, 20));</div><div class="line">    sdButton-&gt;onClick = [&amp;]() {</div><div class="line">      testSD();</div><div class="line">    };</div><div class="line">    sdResultLabel = <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;&quot;</span>, Point(210, y));</div><div class="line"></div><div class="line">    y += 44;</div><div class="line"></div><div class="line">    <span class="comment">// GPIO test</span></div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> GPIOS_IN[] = { 0, 1, 2, 3, 12, 13, 14, 16, 17, 18, 34, 35, 36, 39 };</div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> GPIOS_OUT[] = { 0, 1, 2, 3, 12, 13, 14, 16, 17, 18 };</div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;GPIO TEST:&quot;</span>, Point(10, y));</div><div class="line"></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;In&quot;</span>, Point(120, y - 18));</div><div class="line">    gpioInComboBox = <span class="keyword">new</span> uiComboBox(frame, Point(120, y - 3), Size(34, 22), 60);</div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <span class="keyword">sizeof</span>(GPIOS_IN) / <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>); ++i)</div><div class="line">      gpioInComboBox-&gt;items().appendFmt(<span class="stringliteral">&quot;%d&quot;</span>, GPIOS_IN[i]);</div><div class="line">    gpioInComboBox-&gt;onChange = [&amp;]() {</div><div class="line">      gpioIn = gpioInComboBox-&gt;selectedItem() &gt; -1 ? GPIOS_IN[gpioInComboBox-&gt;selectedItem()] : GPIOS_IN[10];</div><div class="line">      pinMode(gpioIn, INPUT);</div><div class="line">    };</div><div class="line">    gpioIn = GPIOS_IN[10];</div><div class="line">    pinMode(gpioIn, INPUT);</div><div class="line">    gpioInComboBox-&gt;selectItem(10);</div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;State&quot;</span>, Point(162, y - 18));</div><div class="line">    gpioInState = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;&quot;</span>, Point(162, y - 3), Size(25, 22), uiButtonKind::Switch);</div><div class="line"></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;Out&quot;</span>, Point(250, y - 18));</div><div class="line">    gpioOutComboBox = <span class="keyword">new</span> uiComboBox(frame, Point(250, y - 3), Size(34, 22), 60);</div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <span class="keyword">sizeof</span>(GPIOS_OUT) / <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>); ++i)</div><div class="line">      gpioOutComboBox-&gt;items().appendFmt(<span class="stringliteral">&quot;%d&quot;</span>, GPIOS_OUT[i]);</div><div class="line">    gpioOutComboBox-&gt;onChange = [&amp;]() {</div><div class="line">      gpioOut = gpioOutComboBox-&gt;selectedItem() &gt; -1 ? GPIOS_OUT[gpioOutComboBox-&gt;selectedItem()] : GPIOS_OUT[2];</div><div class="line">      pinMode(gpioOut, OUTPUT);</div><div class="line">      updateGPIOOutState();</div><div class="line">    };</div><div class="line">    gpioOut = GPIOS_OUT[2];</div><div class="line">    pinMode(gpioOut, OUTPUT);</div><div class="line">    gpioOutComboBox-&gt;selectItem(2);</div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;State&quot;</span>, Point(292, y - 18));</div><div class="line">    gpioOutState = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;&quot;</span>, Point(292, y - 3), Size(25, 22), uiButtonKind::Switch);</div><div class="line">    gpioOutState-&gt;setDown(<span class="keyword">false</span>);</div><div class="line">    gpioOutState-&gt;onChange = [&amp;]() {</div><div class="line">      updateGPIOOutState();</div><div class="line">    };</div><div class="line">    updateGPIOOutState();</div><div class="line"></div><div class="line">    gpioTimer = setTimer(frame, 100);</div><div class="line"></div><div class="line">    y += 40;</div><div class="line"></div><div class="line">    <span class="comment">// wifi</span></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;WIFI TEST:&quot;</span>, Point(10, y));</div><div class="line">    wifiButton = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Start&quot;</span>, Point(120, y - 3), Size(80, 20));</div><div class="line">    wifiButton-&gt;onClick = [&amp;]() {</div><div class="line">      testWifi();</div><div class="line">    };</div><div class="line">    wifiResultLabel = <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;&quot;</span>, Point(210, y));</div><div class="line"></div><div class="line"></div><div class="line">    <span class="comment">// timer</span></div><div class="line">    frame-&gt;onTimer = [&amp;](uiTimerHandle h) {</div><div class="line">      <span class="keywordflow">if</span> (h == soundTimer) {</div><div class="line">        soundGenerator-&gt;playSound(SineWaveformGenerator(), random(100, 3000), 230, 100);</div><div class="line">      }</div><div class="line">      <span class="keywordflow">if</span> (h == gpioTimer) {</div><div class="line">        updateGPIOInState();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;FabGL - Copyright 2019-2020 by Fabrizio Di Vittorio&quot;</span>, Point(175, 313));</div><div class="line">    <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;WWW.FABGL.COM&quot;</span>, Point(260, 330));</div><div class="line"></div><div class="line">  }</div><div class="line"></div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> updateGPIOOutState() {</div><div class="line">    <span class="keywordflow">if</span> (gpioOutState-&gt;down()) {</div><div class="line">      gpioOutState-&gt;setText(<span class="stringliteral">&quot;1&quot;</span>);</div><div class="line">      digitalWrite(gpioOut, HIGH);</div><div class="line">    } <span class="keywordflow">else</span> {</div><div class="line">      gpioOutState-&gt;setText(<span class="stringliteral">&quot;0&quot;</span>);</div><div class="line">      digitalWrite(gpioOut, LOW);</div><div class="line">    }</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> updateGPIOInState() {</div><div class="line">    <span class="keywordflow">if</span> (digitalRead(gpioIn) == HIGH) {</div><div class="line">      gpioInState-&gt;setText(<span class="stringliteral">&quot;1&quot;</span>);</div><div class="line">    } <span class="keywordflow">else</span> {</div><div class="line">      gpioInState-&gt;setText(<span class="stringliteral">&quot;0&quot;</span>);</div><div class="line">    }</div><div class="line">    gpioInState-&gt;repaint();</div><div class="line">  }</div><div class="line"></div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> testSD() {</div><div class="line">    <span class="comment">// mount test</span></div><div class="line">    FileBrowser fb;</div><div class="line">    fb.unmountSDCard();</div><div class="line">    <span class="keywordtype">bool</span> r = fb.mountSDCard(<span class="keyword">false</span>, <span class="stringliteral">&quot;/SD&quot;</span>);</div><div class="line">    <span class="keywordflow">if</span> (!r) {</div><div class="line">      sdResultLabel-&gt;labelStyle().textColor = <a name="a4"></a><a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1ca2ed18d4ecd62410034c7ff19a1384357">Color::BrightRed</a>;</div><div class="line">      sdResultLabel-&gt;setText(<span class="stringliteral">&quot;Mount Failed!&quot;</span>);</div><div class="line">      <span class="keywordflow">return</span>;</div><div class="line">    }</div><div class="line">    <span class="comment">// write test</span></div><div class="line">    fb.setDirectory(<span class="stringliteral">&quot;/SD&quot;</span>);</div><div class="line">    constexpr <span class="keywordtype">int</span> size = 16384;</div><div class="line">    <span class="keywordtype">bool</span> ok = <span class="keyword">true</span>;</div><div class="line">    <span class="keyword">auto</span> fname = fb.createTempFilename();</div><div class="line">    <span class="keyword">auto</span> f = fopen(fname, <span class="stringliteral">&quot;wb&quot;</span>);</div><div class="line">    <span class="keywordflow">if</span> (f) {</div><div class="line">      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; size; ++i)</div><div class="line">        <span class="keywordflow">if</span> (fputc(i &amp; 0xff, f) != (i &amp; 0xff)) {</div><div class="line">          ok = <span class="keyword">false</span>;</div><div class="line">          <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">      fclose(f);</div><div class="line">    }</div><div class="line">    <span class="keywordflow">if</span> (!f || !ok) {</div><div class="line">      free(fname);</div><div class="line">      sdResultLabel-&gt;labelStyle().textColor = <a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1ca2ed18d4ecd62410034c7ff19a1384357">Color::BrightRed</a>;</div><div class="line">      sdResultLabel-&gt;setText(<span class="stringliteral">&quot;Write Failed!&quot;</span>);</div><div class="line">      <span class="keywordflow">return</span>;</div><div class="line">    }</div><div class="line">    <span class="comment">// read test</span></div><div class="line">    f = fopen(fname, <span class="stringliteral">&quot;rb&quot;</span>);</div><div class="line">    <span class="keywordflow">if</span> (f) {</div><div class="line">      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; size; ++i)</div><div class="line">        <span class="keywordflow">if</span> (fgetc(f) != (i &amp; 0xff)) {</div><div class="line">          ok = <span class="keyword">false</span>;</div><div class="line">          <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">      fclose(f);</div><div class="line">    }</div><div class="line">    free(fname);</div><div class="line">    <span class="keywordflow">if</span> (!f || !ok) {</div><div class="line">      sdResultLabel-&gt;labelStyle().textColor = <a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1ca2ed18d4ecd62410034c7ff19a1384357">Color::BrightRed</a>;</div><div class="line">      sdResultLabel-&gt;setText(<span class="stringliteral">&quot;Read Failed!&quot;</span>);</div><div class="line">      <span class="keywordflow">return</span>;</div><div class="line">    }</div><div class="line"></div><div class="line">    sdResultLabel-&gt;labelStyle().textColor = <a name="a5"></a><a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cad0784a3f969fe736e8b271a5a161d106">Color::Green</a>;</div><div class="line">    sdResultLabel-&gt;setText(<span class="stringliteral">&quot;Success!&quot;</span>);</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> testWifi() {</div><div class="line">    <span class="keyword">auto</span> r = WiFi.scanNetworks(<span class="keyword">false</span>, <span class="keyword">true</span>);</div><div class="line">    <span class="keywordflow">if</span> (r == WIFI_SCAN_FAILED) {</div><div class="line">      wifiResultLabel-&gt;labelStyle().textColor = <a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1ca2ed18d4ecd62410034c7ff19a1384357">Color::BrightRed</a>;</div><div class="line">      wifiResultLabel-&gt;setText(<span class="stringliteral">&quot;Wifi Scan Failed!&quot;</span>);</div><div class="line">    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (r == 0) {</div><div class="line">      wifiResultLabel-&gt;labelStyle().textColor = <a name="a6"></a><a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cabf28513245738599d13e3ce36bd16c82">Color::Yellow</a>;</div><div class="line">      wifiResultLabel-&gt;setText(<span class="stringliteral">&quot;Ok, No Network Found!&quot;</span>);</div><div class="line">    } <span class="keywordflow">else</span> {</div><div class="line">      wifiResultLabel-&gt;labelStyle().textColor = <a class="code" href="group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cad0784a3f969fe736e8b271a5a161d106">Color::Green</a>;</div><div class="line">      wifiResultLabel-&gt;setTextFmt(<span class="stringliteral">&quot;Ok, Found %d Networks&quot;</span>, r);</div><div class="line">    }</div><div class="line">    WiFi.scanDelete();</div><div class="line">  }</div><div class="line"></div><div class="line">} app;</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> setup()</div><div class="line">{</div><div class="line">  <span class="comment">//Serial.begin(115200); delay(500); Serial.write(&quot;\n\n\n&quot;); // DEBUG ONLY</span></div><div class="line"></div><div class="line">  PS2Controller.<a name="a7"></a><a class="code" href="classfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09.html#ab8520612804a921ad834b41214a99c09">begin</a>(PS2Preset::KeyboardPort0_MousePort1, KbdMode::GenerateVirtualKeys);</div><div class="line"></div><div class="line">  DisplayController.<a name="a8"></a><a class="code" href="classfabgl_1_1_bitmapped_display_controller_a6b94fdf3692083a41291eec4920c62d2.html#a6b94fdf3692083a41291eec4920c62d2">queueSize</a> = 350;  <span class="comment">// trade UI speed using less RAM and allow both WiFi and SD Card FS</span></div><div class="line">  DisplayController.begin();</div><div class="line">  DisplayController.<a name="a9"></a>setResolution(VESA_640x480_75Hz, 640, 360);</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> loop()</div><div class="line">{</div><div class="line">  app.runAsync(&amp;DisplayController);</div><div class="line">  vTaskDelete(NULL);</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Wed Dec 9 2020 16:48:29 for FabGL by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
